/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Phong
 */
@Entity
@Table(name = "Articles")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Articles.findAll", query = "SELECT a FROM Articles a"),
    @NamedQuery(name = "Articles.findByArticlesId", query = "SELECT a FROM Articles a WHERE a.articlesId = :articlesId"),
    @NamedQuery(name = "Articles.findByArticlesTitle", query = "SELECT a FROM Articles a WHERE a.articlesTitle = :articlesTitle"),
    @NamedQuery(name = "Articles.findByArticlesContent", query = "SELECT a FROM Articles a WHERE a.articlesContent = :articlesContent"),
    @NamedQuery(name = "Articles.findByArticlesCreateDate", query = "SELECT a FROM Articles a WHERE a.articlesCreateDate = :articlesCreateDate")})
public class Articles implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Column(name = "ArticlesId")
    private Integer articlesId;
    @Size(max = 300)
    @Column(name = "ArticlesTitle")
    private String articlesTitle;
    @Size(max = 2147483647)
    @Column(name = "ArticlesContent")
    private String articlesContent;
    @Column(name = "ArticlesCreateDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date articlesCreateDate;
    @JoinColumn(name = "MembersID", referencedColumnName = "MembersID")
    @ManyToOne
    private Members membersID;

    public Articles() {
    }

    public Articles(Integer articlesId) {
        this.articlesId = articlesId;
    }

    public Integer getArticlesId() {
        return articlesId;
    }

    public void setArticlesId(Integer articlesId) {
        this.articlesId = articlesId;
    }

    public String getArticlesTitle() {
        return articlesTitle;
    }

    public void setArticlesTitle(String articlesTitle) {
        this.articlesTitle = articlesTitle;
    }

    public String getArticlesContent() {
        return articlesContent;
    }

    public void setArticlesContent(String articlesContent) {
        this.articlesContent = articlesContent;
    }

    public Date getArticlesCreateDate() {
        return articlesCreateDate;
    }

    public void setArticlesCreateDate(Date articlesCreateDate) {
        this.articlesCreateDate = articlesCreateDate;
    }

    public Members getMembersID() {
        return membersID;
    }

    public void setMembersID(Members membersID) {
        this.membersID = membersID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (articlesId != null ? articlesId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Articles)) {
            return false;
        }
        Articles other = (Articles) object;
        if ((this.articlesId == null && other.articlesId != null) || (this.articlesId != null && !this.articlesId.equals(other.articlesId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Articles[ articlesId=" + articlesId + " ]";
    }
    
}
